package com.cgc.shop.action;

import java.io.ByteArrayInputStream;
import java.util.HashMap;

import javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar;

import net.sf.json.JSONObject;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.cgc.shop.model.Category;

@Controller("categoryAction")
@Scope("prototype")
public class CategoryAction extends BaseAction<Category>{
	public String queryJoinAccount() {
		jsonMap = new HashMap<String, Object>();
		jsonMap.put("total", categoryService.getCount(model.getName()));
		jsonMap.put("rows", categoryService.queryJoinAccount(model.getName(), page, rows));
		return "queryJoinAccount";
	}
	
	public String  deleteByIds() {
		categoryService.deleteByIds(ids);
		inputStream = new ByteArrayInputStream("success".getBytes());
		return "deleteByIds";
	}
	
	public void save() {
		categoryService.save(model);
	}
	
	public void update() {
		categoryService.update(model);
	}
	
	public String query() {
		jsonList = categoryService.query();
		return "query";
	}
}
